<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>职工列表的新增页面</title>
</head>
<body>

<div class="easyui-layout" style="width:100%;height:100%;">
   <div data-options="region:'east',split:false"  style="width:350px;">
    <div class="easyui-panel" style="padding:5px" title="授权菜单" data-options="fit:true">
		<ul id="menuTree" class="easyui-tree" data-options="url:'${ctx }/system/shopPost/loadGrantMenuTree.jhtml',method:'get',checkbox:true,animate:true,lines:true"></ul>
	</div>
   </div>
<div data-options="region:'center'" >
	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'center',border:false" style="padding: 5px;"  title="职位信息">
			<form id="addForm" action="" method="post" >
			 <input type="hidden" name="menuids" id="menuids"  />
				<table cellpadding=5 cellspacing=0 width=100% align="center" class="formTabel">
				<input hidden type="text" id="post_id" name="post_id" value="${post.post_id }" />
				<input hidden type="text" id="modify_user_id" name="modify_user_id"  />
					<tr>
						<td align="right" width="100px">职位编码：</td>
						<td><input  type="text"  name="post_code" required="true"
							class="easyui-textbox" data-options="validType:'loginname'"
							style="width: 280px; height: 30px" value="${post.post_code}" ></td>
					</tr>
					<tr>
						<td align="right" width="100px">职位名称：</td>
						<td><input name="post_name" type="text"
						class="easyui-textbox" data-options="validType:'length[1,50]'"
							style="width: 280px; height: 30px" required="true" value="${post.post_name}" ></td>
					</tr>
					<tr>
						<td align="right" width="100px">更新时间：</td>
						<td><input name="modify_time" type="date"
						class="easyui-textbox" data-options="validType:'length[1,50]'"
							style="width: 279px; height: 30px" required="true"></td>
					</tr>
					<tr>
						<td align="right" width="100px">备注：</td>
						<td><input name="post_desc" type="text"  class="easyui-textbox"
							data-options="multiline:true,validType:'length[0,200]'"
							style="width: 280px; height: 140px" value="${post.post_desc}" ></td>
					</tr>
				</table>
			</form>
		</div>
		<div class="layui-form-item" style="position:absolute; left:500px;top:0px;">
		            <ul id="treeDemo" class="ztree"  style="background-color: #FFFFFF;height:210px ;"></ul>
	    </div>
		<div data-options="region:'south',border:false" height="35px"
			style="text-align: center; background: #F4F4F4; padding: 5px 0 0;">
			<a class="easyui-linkbutton" data-options="iconCls:'ok'"href="javascript:void(0)"
			   onclick="submitShopPostData()" style="width: 70px">保存</a> &nbsp;
		 <!--    <a class="easyui-linkbutton" data-options="iconCls:'close'" href="javascript:void(0)"
				onclick="closeWindow('addWindow')" style="width: 70px">关闭</a> -->
		</div>
	</div>
   </div>
 </div>
<link rel="stylesheet" href="/bsc/static/ztree/css/demo.css" type="text/css">
<link rel="stylesheet" href="/bsc/static/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="/bsc/static/ztree/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/bsc/static/ztree/js/jquery.ztree.core-3.5.min.js"></script>
<script type="text/javascript" src="/bsc/static/ztree/js/jquery.ztree.excheck-3.5.min.js"></script>
<script type="text/javascript" src="/bsc/static/ ztree/js/jquery.ztree.exedit-3.5.min.js"></script>
	<script type="text/javascript">
		var setting = {
			check: {
				enable: true
			},
			data: {
				simpleData: {
					enable: true
				}
			}
		};
		var zNodes =${json};
		$(document).ready(function() {
			$.fn.zTree.init($("#treeDemo"), setting, zNodes);
			/* var treeObj = $.fn.zTree.getZTreeObj("treeDemo");
			  //将现有节点全部选中（不包括还没有展开的节点）
			  treeObj.checkAllNodes(false); */
		});
		function checkAll(){
			var treeObj = $.fn.zTree.getZTreeObj("treeDemo");
			  //将现有节点全部选中（不包括还没有展开的节点）
			  treeObj.checkAllNodes(true);
		}
		function submitShopPostData(){
			//初始化树
			var zTree = $.fn.zTree.getZTreeObj("treeDemo");
			var nodes=zTree.getCheckedNodes(true);  //获取复选框改变的值
			var array=[];
			$.each(nodes,function(index,n){
				array.push(n.id);
			});
			var data=array.join(",");
			$("#modify_user_id").val(data);
			$.ajax({
			    	url:"/bsc/bis_shop_post/upadte",
			    	type:"post",
			    	data:$("#addForm").serialize(),
			    	success:function(msg){
			    		alert("修改成功")
			    		parent.location.reload();
			    	}
			     });   
		} 
	</script>
</body>
</html>